Skip to content

fix: MCP node should not mark all params required when schema has no required (#6955) - #7086

Merged
liuruibin merged 1 commit into
1Panel-dev:v2from
Frank-zhu0404:fix/issue-6955-mcp-required
Sep 18, 2026
Merged

liuruibin merged 1 commit into
1Panel-dev:v2from
Frank-zhu0404:fix/issue-6955-mcp-required

Conversation

@Frank-zhu0404

Copy link
Copy Markdown
Contributor

Summary

  • Fixes [Bug] MCP 节点在工具 schema 无 required 字段时,将全部参数误标为必填 #6955: when an MCP tool inputSchema / args_schema omits required (or uses []), the MCP workflow node incorrectly treated every parameter as required.
  • Root cause: args_schema.required?.indexOf(item) !== -1 evaluates to true when required is missing (undefined !== -1).
  • Change: default missing/empty required to [] for both top-level and nested property schemas so only explicitly listed fields are required.

Test plan

  • Add MCP Call node; fetch tools from a server whose tool schema has no required (e.g. SQLBot mcp_start)
  • Confirm tool params are not marked with red *
  • Save/validate the node with only optional fields filled (e.g. only token) — should succeed
  • With a schema that has required: ["foo"], only foo shows as required and validation still enforces it

When inputSchema has no required field (or it is empty), optional
chaining made `undefined !== -1` true and marked every param required.
Default missing/empty required to [] so params stay optional.
@liuruibin
liuruibin merged commit 0dc24be into 1Panel-dev:v2 Sep 18, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] MCP 节点在工具 schema 无 required 字段时,将全部参数误标为必填

2 participants